<!--
  ~ Copyright 2018 Alibaba Group.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="zh">
<head>
<!-- Generated by javadoc (version 1.7.0_79) on Fri Sep 11 11:58:17 CST 2015 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Task</title>
<meta name="date" content="2015-09-11">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="Task";
    }
//-->
</script>
<noscript>
<div>您的浏览器已禁用 JavaScript。</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="跳过导航链接"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="导航">
<li><a href="../../../../com/tmall/wireless/alpha/package-summary.html">程序包</a></li>
<li class="navBarCell1Rev">类</li>
<li><a href="package-tree.html">树</a></li>
<li><a href="../../../../deprecated-list.html">已过时</a></li>
<li><a href="../../../../index-files/index-1.html">索引</a></li>
<li><a href="../../../../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/tmall/wireless/alpha/AlphaUtils.html" title="com.tmall.wireless.alpha中的类"><span class="strong">上一个类</span></a></li>
<li><a href="../../../../com/tmall/wireless/alpha/Task.OnFinishedListener.html" title="com.tmall.wireless.alpha中的接口"><span class="strong">下一个类</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/tmall/wireless/alpha/Task.html" target="_top">框架</a></li>
<li><a href="Task.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">所有类</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>概要:&nbsp;</li>
<li><a href="#nested_class_summary">嵌套</a>&nbsp;|&nbsp;</li>
<li><a href="#field_summary">字段</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">构造器</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">方法</a></li>
</ul>
<ul class="subNavList">
<li>详细资料:&nbsp;</li>
<li><a href="#field_detail">字段</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">构造器</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">方法</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.tmall.wireless.alpha</div>
<h2 title="类 Task" class="title">类 Task</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>com.alibaba.android.alpha.Task</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public abstract class <span class="strong">Task</span>
extends java.lang.Object</pre>
<div class="block">这个类将一个个关联的<code>Task</code>，组织成PERT网路图的方式进行执行。可以通过<a href="../../../../com/tmall/wireless/alpha/Task.ProjectBuilder.html" title="com.tmall.wireless.alpha中的类"><code>Task.ProjectBuilder</code></a>
 将<code>Task</code>组装成完整的<code>Project</code>，该<code>Project</code>可以直接执行，也可以嵌套在另外一个<code>Project</code>
 中作为其中一个<code>Task</code>执行。

 Created by zhangshuliang.zsl on 15/8/18.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested_class_summary">
<!--   -->
</a>
<h3>嵌套类概要</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="嵌套类概要表, 列表嵌套类和解释">
<caption><span>嵌套类</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">限定符和类型</th>
<th class="colLast" scope="col">类和说明</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.OnFinishedListener.html" title="com.tmall.wireless.alpha中的接口">Task.OnFinishedListener</a></strong></code>
<div class="block"><code>Project</code>执行结束的回调。</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.ProjectBuilder.html" title="com.tmall.wireless.alpha中的类">Task.ProjectBuilder</a></strong></code>
<div class="block">通过<code>ProjectBuilder</code>将多个<code>Task</code>组成一个<code>Project</code>。</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!--   -->
</a>
<h3>字段概要</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="字段概要表, 列表字段和解释">
<caption><span>字段</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">限定符和类型</th>
<th class="colLast" scope="col">字段和说明</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_FINISHED">STATE_FINISHED</a></strong></code>
<div class="block"><code>Task</code>执行状态，<code>Task</code>已经执行完毕</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_IDLE">STATE_IDLE</a></strong></code>
<div class="block"><code>Task</code>执行状态，<code>Task</code>尚未执行</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_RUNNING">STATE_RUNNING</a></strong></code>
<div class="block"><code>Task</code>执行状态，<code>Task</code>正在执行中</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!--   -->
</a>
<h3>构造器概要</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="构造器概要表, 列表构造器和解释">
<caption><span>构造器</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">构造器和说明</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#Task(java.lang.String)">Task</a></strong>(java.lang.String&nbsp;name)</code>
<div class="block">构造<code>Task</code>对象，必须要传入<code>name</code>，便于确定当前是在哪一个任务中。</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#Task(java.lang.String,%20boolean)">Task</a></strong>(java.lang.String&nbsp;name,
    boolean&nbsp;isInUiThread)</code>
<div class="block">构造<code>Task</code>对象。</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!--   -->
</a>
<h3>方法概要</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="方法概要表, 列表方法和解释">
<caption><span>方法</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">限定符和类型</th>
<th class="colLast" scope="col">方法和说明</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#getCurrentState()">getCurrentState</a></strong>()</code>
<div class="block">查询当前该<code>Task</code>执行的状态。</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#isFinished()">isFinished</a></strong>()</code>
<div class="block">判断当前<code>Task</code>已经完成，即状态是否是<a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_FINISHED"><code>STATE_FINISHED</code></a></div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#isRunning()">isRunning</a></strong>()</code>
<div class="block">判断当前<code>Task</code>是否正在运行，即状态是否是<a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_RUNNING"><code>STATE_RUNNING</code></a></div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>abstract void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#run()">run</a></strong>()</code>
<div class="block">在其中实现该<code>Task</code>具体执行的逻辑。</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/tmall/wireless/alpha/Task.html#start()">start</a></strong>()</code>
<div class="block">执行当前<code>Task</code>的任务，这里会调用用户自定义的<a href="../../../../com/tmall/wireless/alpha/Task.html#run()"><code>run()</code></a>。</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!--   -->
</a>
<h3>从类继承的方法&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!--   -->
</a>
<h3>字段详细资料</h3>
<a name="STATE_IDLE">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>STATE_IDLE</h4>
<pre>public static final&nbsp;int STATE_IDLE</pre>
<div class="block"><code>Task</code>执行状态，<code>Task</code>尚未执行</div>
<dl><dt><span class="strong">另请参阅:</span></dt><dd><a href="../../../../constant-values.html#com.tmall.wireless.alpha.Task.STATE_IDLE">常量字段值</a></dd></dl>
</li>
</ul>
<a name="STATE_RUNNING">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>STATE_RUNNING</h4>
<pre>public static final&nbsp;int STATE_RUNNING</pre>
<div class="block"><code>Task</code>执行状态，<code>Task</code>正在执行中</div>
<dl><dt><span class="strong">另请参阅:</span></dt><dd><a href="../../../../constant-values.html#com.tmall.wireless.alpha.Task.STATE_RUNNING">常量字段值</a></dd></dl>
</li>
</ul>
<a name="STATE_FINISHED">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>STATE_FINISHED</h4>
<pre>public static final&nbsp;int STATE_FINISHED</pre>
<div class="block"><code>Task</code>执行状态，<code>Task</code>已经执行完毕</div>
<dl><dt><span class="strong">另请参阅:</span></dt><dd><a href="../../../../constant-values.html#com.tmall.wireless.alpha.Task.STATE_FINISHED">常量字段值</a></dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!--   -->
</a>
<h3>构造器详细资料</h3>
<a name="Task(java.lang.String)">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Task</h4>
<pre>public&nbsp;Task(java.lang.String&nbsp;name)</pre>
<div class="block">构造<code>Task</code>对象，必须要传入<code>name</code>，便于确定当前是在哪一个任务中。该<code>Task</code>默认在异步线程
 中执行。如果要指定在主线程中执行，可以用构造函数<a href="../../../../com/tmall/wireless/alpha/Task.html#Task(java.lang.String,%20boolean)"><code>Task(String, boolean)</code></a>，并指定主线程。</div>
<dl><dt><span class="strong">参数:</span></dt><dd><code>name</code> - <code>Task</code>名字</dd></dl>
</li>
</ul>
<a name="Task(java.lang.String, boolean)">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Task</h4>
<pre>public&nbsp;Task(java.lang.String&nbsp;name,
    boolean&nbsp;isInUiThread)</pre>
<div class="block">构造<code>Task</code>对象。</div>
<dl><dt><span class="strong">参数:</span></dt><dd><code>name</code> - <code>Task</code>名字</dd><dd><code>isInUiThread</code> - <code>true</code>表示该<code>Task</code>需要在主线程执行，<code>false</code>表示在异步线程执行。</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!--   -->
</a>
<h3>方法详细资料</h3>
<a name="start()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>start</h4>
<pre>public&nbsp;void&nbsp;start()</pre>
<div class="block">执行当前<code>Task</code>的任务，这里会调用用户自定义的<a href="../../../../com/tmall/wireless/alpha/Task.html#run()"><code>run()</code></a>。</div>
</li>
</ul>
<a name="run()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>run</h4>
<pre>public abstract&nbsp;void&nbsp;run()</pre>
<div class="block">在其中实现该<code>Task</code>具体执行的逻辑。<br/>
 <strong>注意：<strong/>该函数应该只由框架的<a href="../../../../com/tmall/wireless/alpha/Task.html#start()"><code>start()</code></a>来调用。</div>
</li>
</ul>
<a name="getCurrentState()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getCurrentState</h4>
<pre>public&nbsp;int&nbsp;getCurrentState()</pre>
<div class="block">查询当前该<code>Task</code>执行的状态。</div>
<dl><dt><span class="strong">返回:</span></dt><dd>当前执行状态，状态码如下：
 <a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_FINISHED"><code>STATE_FINISHED</code></a>, <a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_IDLE"><code>STATE_IDLE</code></a>, <a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_RUNNING"><code>STATE_RUNNING</code></a></dd></dl>
</li>
</ul>
<a name="isRunning()">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isRunning</h4>
<pre>public&nbsp;boolean&nbsp;isRunning()</pre>
<div class="block">判断当前<code>Task</code>是否正在运行，即状态是否是<a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_RUNNING"><code>STATE_RUNNING</code></a></div>
<dl><dt><span class="strong">返回:</span></dt><dd><code>true</code>表示当前正在执行中，否则表示为执行或者执行已经结束。</dd></dl>
</li>
</ul>
<a name="isFinished()">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>isFinished</h4>
<pre>public&nbsp;boolean&nbsp;isFinished()</pre>
<div class="block">判断当前<code>Task</code>已经完成，即状态是否是<a href="../../../../com/tmall/wireless/alpha/Task.html#STATE_FINISHED"><code>STATE_FINISHED</code></a></div>
<dl><dt><span class="strong">返回:</span></dt><dd><code>true</code>表示已经执行结束，否则表示尚未执行或者正在执行中。</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="跳过导航链接"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="导航">
<li><a href="../../../../com/tmall/wireless/alpha/package-summary.html">程序包</a></li>
<li class="navBarCell1Rev">类</li>
<li><a href="package-tree.html">树</a></li>
<li><a href="../../../../deprecated-list.html">已过时</a></li>
<li><a href="../../../../index-files/index-1.html">索引</a></li>
<li><a href="../../../../help-doc.html">帮助</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/tmall/wireless/alpha/AlphaUtils.html" title="com.tmall.wireless.alpha中的类"><span class="strong">上一个类</span></a></li>
<li><a href="../../../../com/tmall/wireless/alpha/Task.OnFinishedListener.html" title="com.tmall.wireless.alpha中的接口"><span class="strong">下一个类</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/tmall/wireless/alpha/Task.html" target="_top">框架</a></li>
<li><a href="Task.html" target="_top">无框架</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">所有类</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>概要:&nbsp;</li>
<li><a href="#nested_class_summary">嵌套</a>&nbsp;|&nbsp;</li>
<li><a href="#field_summary">字段</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_summary">构造器</a>&nbsp;|&nbsp;</li>
<li><a href="#method_summary">方法</a></li>
</ul>
<ul class="subNavList">
<li>详细资料:&nbsp;</li>
<li><a href="#field_detail">字段</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor_detail">构造器</a>&nbsp;|&nbsp;</li>
<li><a href="#method_detail">方法</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
